<template>
  <div>
    <el-button type="success" style="margin-bottom:30px" @click="goback"
      >返回</el-button
    >

    <el-card style="margin-bottom:30px">
      <el-timeline :reverse="reverse">
        <el-timeline-item
          v-for="(item, index) in kuaidiDetial"
          :key="index"
          :timestamp="item.ftime"
        >
          {{ item.context }}
        </el-timeline-item>
      </el-timeline>
    </el-card>
    <el-card
      style="margin-bottom:30px"
      class="saoma"
      v-if="saomaDetial.length != 0"
    >
      <div>快递录入时间: {{ saomaDetial.express_time }}</div>
      <div>扫码人openid: {{ saomaDetial.scanOpenid }}</div>
      <div>
        扫码照片(多图):
        <img
          v-for="(item, index) in saomaDetial.scanPhoto"
          :src="item"
          :key="index"
          alt=""
        />
      </div>
      <div>扫码备注: {{ saomaDetial.scanRemark }}</div>
      <div>扫码时间: {{ saomaDetial.scan_time }}</div>
    </el-card>
  </div>
</template>

<script>
import { getExpressInfoOther } from "../../utils/api";
export default {
  data() {
    return {
      expressDetial: {
        expressNo: "",
        order: 1,
        deviceId: ""
      },
      //   快递信息
      kuaidiDetial: "",
      //   物流信息
      wuliuDetial: "",
      // 扫码信息
      saomaDetial: ""
    };
  },
  created() {
    this.expressDetial.deviceId = window.sessionStorage.getItem("deviceId");
    this.expressDetial.expressNo = window.sessionStorage.getItem("expressNo");
    this.getExpressDetal();
  },
  methods: {
    getExpressDetal() {
      this.postRequest(getExpressInfoOther, this.expressDetial).then(res => {
        if (res.code == 200) {
          this.kuaidiDetial = res.data.express.data;
          this.wuliuDetial = res.data.sign;
          this.saomaDetial = res.data.scan;
        }
      });
    },
    // 返回上一级
    goback() {
      this.$store.dispatch("delVisitedViews", this.$route).then(obj => {
        this.$router.push("/kuaidigetkuaidi");
      });
      window.sessionStorage.removeItem("expressNo");
      window.sessionStorage.removeItem("deviceId");
    }
  }
};
</script>

<style lang="less">
.saoma {
  display: flex;
  flex-direction: column;
  div {
    line-height: 80px;
  }
}
</style>
